


function loadJs(url, callback) {
    var script = document.createElement('script');
    script.type = "text/javascript";
    if (typeof(callback) != "undefined") {
        if (script.readyState) {
            script.onreadystatechange = function() {
                if (script.readyState == "loaded" || script.readyState == "complete") {
                    script.onreadystatechange = null;
                    callback();
                }
            }
        } else {
            script.onload = function() {
                callback();
            }
        }
    }
    script.src = url;
    //console.log(document.body)
    var head = document.getElementsByTagName("head")[0];
    head.appendChild(script);
}


var widgetServer
for (var i=0;i<document.getElementsByTagName('script').length;i++) {
	var scriptTag = document.getElementsByTagName('script')[i]
	if (scriptTag.src.indexOf('widget/lib/init.js')!=-1) {
		widgetServer = scriptTag.src.substring(0,scriptTag.src.indexOf('widget/lib/init.js')-1).replace("/static","")
	}
}


//console.log(widgetServer)
loadJs(widgetServer+"/static/widget/lib/jquery-1.8.3.min.js", function() {
    $.getScript(widgetServer+"/static/widget/lib/echarts.min.js", function() {
	  	$.getScript(widgetServer+"/static/widget/lib/baiduTemplate.js", function() {
	  	
	  		$.getScript(widgetServer+"/static/widget/lib/baiduTemplate.js", function() {
	  			
	  			$.getScript(widgetServer+"/static/widget/lib/chart.js", function() {
	  	
	  	
				});
	  	
			});

		});
	});
});